<template>
  <div class="app-container">
    <el-dialog
      v-dialogDrag
      ref="dialog"
      :visible.sync="dialogVisible"
      :append-to-body="true"
      :close-on-click-modal="false"
      :before-close="close"
      title="U8配件库存"
      width="80%">
      <!-- 信息列表 -->
      <el-form ref="searchForm" :model="search" label-width="95px" label-position="right" size="mini">
        <el-row :gutter="6">
          <el-col :xs="24" :sm="8" :md="6">
            <el-form-item prop="partCode" label="配件代码">
              <el-input v-model="search.partCode" clearable/>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="8" :md="6">
            <el-form-item prop="partName" label="配件名称">
              <el-input v-model="search.partName" clearable/>
            </el-form-item>
          </el-col>
          <div style="text-align:right">
            <el-button type="primary" icon="el-icon-search" @click="searchHandle">查询</el-button>
            <el-button icon="el-icon-refresh" @click="resetForm('searchForm')">重置</el-button>
          </div>
        </el-row>
      </el-form>
      <div class="table">
        <!--<div class="tableHead">
          <div class="title">配件库存</div>
        </div>-->
        <el-table v-loading="load" ref="table" :data="stockList" tooltip-effect="dark" border>
          <el-table-column label="序号" width="50" type="index"/>
          <el-table-column prop="partCode" label="配件代码" min-width="140" show-overflow-tooltip/>
          <el-table-column prop="partName" label="配件名称" min-width="160" show-overflow-tooltip/>
          <el-table-column prop="orderQtty" label="订单数量" min-width="100"/>
          <el-table-column prop="pjcQtty" label="备件仓" min-width="100"/>
          <el-table-column prop="oilQtty" label="油品仓" min-width="100"/>
          <el-table-column prop="sale1Qtty" label="销售一处仓" min-width="110"/>
          <el-table-column prop="sale2Qtty" label="销售二处仓" min-width="110"/>
          <el-table-column prop="bncQtty" label="保内仓" min-width="100"/>
          <el-table-column prop="bnzgcQtty" label="保内整改仓" min-width="100"/>
          <el-table-column prop="jsQtty" label="寄售仓" min-width="100"/>
          <el-table-column prop="tfcQtty" label="投放仓" min-width="100"/>
          <el-table-column prop="wfcQtty" label="外发仓" min-width="100"/>
        </el-table>
      </div>
      <div slot="footer" class="dialog-footer" style="text-align: center">
        <el-button type="text">
          <i class="el-icon-search magnifier" />
        </el-button>
        <el-button @click="close">关 闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  searchU8Stock
} from '@/api/part/dms/basedata/baseCommon'
import Pagination from '@/components/Pagination'
import formMixins from '@/mixins/formMixins'

export default {
  name: 'U8Stock',
  components: {
    Pagination
  },
  mixins: [formMixins],
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    },
    partList: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      search: {
        partCode: '',
        partName: '',
        partList: []
      },
      stockList: [],
      load: false
    }
  },
  watch: {
  },
  mounted() {
  },
  methods: {
    init() {
      this.searchHandle()
    },
    searchHandle() {
      this.search.partList = this.partList
      searchU8Stock(this.search)
        .then(res => {
          this.stockList = res
          this.load = false
        })
        .catch(err => {
          this.load = false
        })
    },
    close() {
      this.search = {
        partCode: '',
        partName: '',
        partList: []
      }
      this.stockList = []
      this.load = false
      this.$emit('update:dialogVisible', false)
    }
  }
}
</script>

<style>
</style>
